package com.yfp.goods.controller;

import com.yfp.common.core.domain.R;
import com.yfp.goods.service.GoodsDetailImgService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品详情图片表(GoodsDetailImg)表控制层
 *
 * 
 * @since 2023-12-20 22:22:36
 */
@Tag(name = "商品详情图片")
@RestController
@RequestMapping("goodsDetailImg")
public class GoodsDetailImgController {
    /**
     * 服务对象
     */
    @Resource
    private GoodsDetailImgService goodsDetailImgService;

    @Operation(summary = "根据商品ID查询图片")
    @GetMapping("{goodsId}")
    public R queryByGoodsId(@PathVariable String goodsId) {
        return R.ok(this.goodsDetailImgService.queryByGoodsId(goodsId));
    }


    @Operation(summary = "取消资源关联")
    @GetMapping("del/{id}")
    public R delete(@PathVariable String id) {
        return this.goodsDetailImgService.delete(id) ? R.ok() : R.fail();
    }

}

